package com.bodu.system.service.impl;

import com.bodu.core.entity.ParamReq;
import com.bodu.system.entity.request.CodeGenConfigRequest;
import com.bodu.system.entity.vo.CodeGenConfigVo;
import com.bodu.system.mapper.CodeGenConfigMapper;
import com.bodu.system.service.CodeGenConfigService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Administrator
 */
@Service
public class CodeGenConfigServiceImpl implements CodeGenConfigService {

    @Resource
    private CodeGenConfigMapper codeGenConfigMapper;

    @Override
    public CodeGenConfigVo getModel(Long id) {
        return codeGenConfigMapper.getModel(id);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public Long save(CodeGenConfigRequest request) {
        codeGenConfigMapper.save(request);
        return request.getId();
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public Long update(CodeGenConfigRequest request) {
        codeGenConfigMapper.update(request);
        return request.getId();
    }

    @Override
    public List<CodeGenConfigVo> listPage(ParamReq<CodeGenConfigRequest> params) {
        return codeGenConfigMapper.listPage(params);
    }

    @Override
    public Integer countPage(ParamReq<CodeGenConfigRequest> params) {
        return codeGenConfigMapper.countPage(params);
    }

    @Override
    public Integer updateDelFlagById(Long id, Integer delFlag) {
        return codeGenConfigMapper.updateDelFlagById(id, delFlag);
    }
}
